import java.util.Scanner;

import book.BookList;
import user.User;
import user.AdminUser;
import user.NormalUser;
import Operation.IOperation;


public class Main {

    public static User login() {
        System.out.println("*****欢迎进入图书管理系统*****");
        Scanner scanner = new Scanner(System.in);

        System.out.println("请输入你的名字");
        String name = scanner.nextLine();

        System.out.println("请选择你的身份");
        System.out.println("1. 普通用户");
        System.out.println("2. 管理员用户");
        int option = scanner.nextInt();
        if (option == 1) {
            return new NormalUser(name);
        } else {
            return new AdminUser(name);
        }
    }


    public static void main(String[] args) {
        BookList bookList = new BookList();
        User user = login();
        while(true) {
            int choice = user.menu();
            user.doOperation(choice, bookList);
        }

    }
}
